#ifndef __stereoapp_h__
#define __stereoapp_h__

#include <cv.h>
#include <highgui.h>
#include <stdio.h>
#include <vector>
#include <jpgd.h>
#include <jpge.h>
#include <profiler.h>
#include <camera.h>
#include <mjpeg_streamer.h>
#include <socket.h>
#include <property_manager.h>
#include <font.h>
#include <colors.h>
#include <bp.h>
#include <appcommon.h>
#include <multithreading.h>
#include <detector.h>
#include <hog_image.h>
#include <classfier.h>
#include <tree.h>
#include <hogtracker.h>
#include <place_locator.h>
#include <navi_glut.h>
#include <socket.h>
#include <speaker.h>
#include <lktrack.h>

class ClientStereoApp: public MJPEGClientI
{
	MJPEGStreamer* streamer;
	Speaker* speaker;
	StereoCamera* cam;
	GText* smallfont;
	char kbkey;
	float expected_frame_duration;
	int voice_service_port;
	
	public:
	ClientStereoApp(MJPEGStreamer* s);
	IplImage* on_get_frame();
	void on_handshake_rcv(HandShakeHeader* header);
	char get_kb_key();
};

class ServerStereoApp: public MJPEGServerI, public TCallI
{
	MJPEGStreamer* streamer;
	BP* bp;
	
	Detector* detector;
	IplImage* left;
	IplImage* left_hold;
	IplImage* right;
	IplImage* right_hold;

	IplImage* hogworker_input;
	IplImage* hogworker_output;
	IplImage* hogworker_outputBig;
	
	IplImage* locatorworker_input;
	IplImage* locatorworker_output;
	
	IplImage* detector_output;
	IplImage* depth_outputBig;
	IplImage* detector_outputBig;
	
	int lastkey;
	
	bool show_small_images;
	bool show_3dviz;
	int depth_th;
		
	Worker* hogworker;
	Worker* locatorworker;
	Worker* bpworker;
	Tracker* tracker;
	PlaceLocator* place_locator;
	Navi3D* navi3d;
	PTTracker* pttracker;
	
	// idicates which module
	// handles menu inputss
	int activemenu;
	
	public:
	ServerStereoApp(MJPEGStreamer* s);
	void on_show_frame(IplImage* mono);
	void on_handshake_send(HandShakeHeader* header);
	void on_kb_key(char c);
	void signal(void* obj);
};

#endif
